<?php

class Admin_Form_General extends Zend_Form
{
	public function init()
	{
		parent::init();

        // Set the method for the display form to POST
		$this
			->setAction('')
			->setMethod('post')
		;

		$stripSlashesFilter = new Euso_Filter_StripSlashes();

		// Create and configure sitename element
		$sitename = new Zend_Form_Element_Text('sitename');
		$sitename
			->setLabel('Site name:')
			->setRequired(true)
			->addFilter($stripSlashesFilter)
			->addFilter('StringTrim')
			->setAttrib('size', 48)
		;
		$this->addElement($sitename);

		// Create and configure tagline element
		$tagline = new Zend_Form_Element_Text('tagline');
		$tagline
			->setLabel('Tagline:')
			->addFilter($stripSlashesFilter)
			->addFilter('StringTrim')
			->setAttrib('size', 48)
		;
		$this->addElement($tagline);

		// Create and configure footer notice element
		$footer = new Zend_Form_Element_TextArea('footer_text');
		$footer
			->setLabel('Footer text:')
			->addFilter($stripSlashesFilter)
			->addFilter('StringTrim')
			->setAttrib('rows', 4)
			->setAttrib('cols', 64)
			->setAttrib('escape', false)
		;
		$this->addElement($footer);

		// Create and configure email element
		$email = new Zend_Form_Element_Text('admin_email');
		$email
			->setLabel('Administrative email address:')
			->setRequired(true)
			->addFilter($stripSlashesFilter)
			->addFilter('StringTrim')
			->addFilter('StringToLower')
			->addValidator('EmailAddress')
			->setAttrib('size', 48)
		;
		$this->addElement($email);

        // Add the submit button
		$submit = new Zend_Form_Element_Submit('submit');
		$submit
			->setLabel('Save')
			->setIgnore(true)
			->setAttrib('class', 'submit')
		;
		$this->addElement($submit);
	}
}
